home *** CD-ROM | disk | FTP | other *** search
- Path: news.primenet.com!jstern
- From: jstern@primenet.com (Josh Stern)
- Newsgroups: comp.lang.c++
- Subject: Re: Need help using g++ and Templates
- Date: 25 Mar 1996 23:23:01 -0700
- Organization: Primenet Services for the Internet
- Sender: root@primenet.com
- Message-ID: <4j82g5$n5d@nnrp1.news.primenet.com>
- References: <4j7017$8m4@sal-sun133.usc.edu>
- Keywords: templates g++
- X-Posted-By: jstern@usr2.primenet.com
-
- Richard Radford <radford@sal-sun133.usc.edu> wrote:
- >I have created object files for the template class and the files that
- >use instances of the template class. When I compile using g++ version
- >2.7 I get errors saying I have a bunch of undefined symbols. The
- >template i'm trying to use is for lists. All the
- >undefined symbols are of the form List<Class I'm trying to create a
- >list of>::member_function_of_template. Can anyone offer any advice on
- >how to compile templates using g++. Any help would be greatly
- >appreciated.
-
- First read the relevant sections of the info file for GCC,
- under the sub-heading C++ extensions. But here is what
- I do: put templates in .h files and use #pragma interface
- with those. Then make sure that each such file gets
- 'associated' with exactly one .cc file and use #pragma
- implementation with that file. The association defaults
- to the files with the same stem name, so you need to
- do explicit #pragma implementation "file.h" for cases
- without "file.cc" in, say, you main.cc module.
-
-
- - Josh
-
-
-
- --
- -------------------------------------------------------------------------------
- jstern
- jstern@primenet.com
- -------------------------------------------------------------------------------
-